<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>

<body>
    <script>
        // 1、var arr2 = [2,1,3]; 打印 最大值 最小值 和中间的值；
        var arry = [2, 1, 3];
        var b = arry[0];
        var c = arry[0];
        var a;
        for (var g = 1; g < arry.length; g++) {
            if (arry[g] > b) {
                b = arry[g];
            }
            if (arry[g] < c) {
                c = arry[g];
            }
            if (arry[g] < b && arry[g] > c) {
                a = arry[g];
            }
        }
        console.log(`该数组里最大值为${b}，最小值为${c},中间值为${a}`);
    </script>
</body>

</html>